<template>
  <div>
    <el-form :model="{}" size="medium" :inline="true" label-width="60px">
      <el-form-item label="操作栏" prop="" v-hasPermi="['system_information_read']">
        <el-button type="success" plain icon="el-icon-check" size="medium" @click="handleAdd">全部已读</el-button>
      </el-form-item>
    </el-form>
    <!-- <template v-if="open">
      <CreatedAdv :title="title" @handleUpdate="handleUpdate"></CreatedAdv>
    </template> -->
  </div>
</template>

<script>
import { putmessage } from "@/api/system/message.js";
import { getmessagecount } from '@/api/mianBody/index.js'
export default {
  components: {
    // CreatedAdv: () => import('../form/CreatedAdv.vue')
  },
  data () {
    return {
      title: '发送站内信息',
      open: false
    }
  },
  methods: {
    /** 新增按钮操作 */
    handleAdd () {
      this.$confirm(`是否确认对所有信息全部已读`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.loading = true;
        putmessage().then(res => {
          if (res.code === 200) {
            this.$message.success(res.msg)
            this.$emit('selectList')
            getmessagecount().then(res => {
              this.$store.commit('SET_MESSAGE', res.data.count)
            })//未读消息数量
          }
          this.loading = false;
        }).catch(() => { this.loading = false; });
      }).catch(() => { })
    },
    /** 修改按钮操作 */
    handleUpdate (row) {
      this.open = false
      this.$emit('selectList')
    },
    /** 删除按钮操作 */
    handleDelete (row) {

    },
  }
}
</script>

<style>
</style>